import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		version: '1.0.0',
		app_id:'market',//测试环境和线上环境
		domain:'https://hzkjapp.sgcctd.cn',
		userInfo: {},
		// API:'http://g278828097.picp.vip/share/'
		API: '/api/share',
		subject: 'cloud-share',
		loading: false,
		isLogin: false,
		activeIndex: 0
	},
	getters: {
		api:state => {//通过方法访问
			return state.API
		},
		getSubject:state => {//通过方法访问
			return state.subject
		},
		getLogin: state => {
			return state.isLogin
		}
	},
	mutations: {
		changeMarketPageName(state, data) {
			state.marketPageName = data;
		},
		setLoading: state => {
			state.loading = true
		},
		cancalLoading: state => {
			state.loading = false
		},
		setLogin(state, data) {
			state.isLogin = data;
		}, 
		setActiveIndex(state, data) {
			state.activeIndex = data;
		},
		setUserInfo(state, data) {
			state.userInfo = data;
		}
	}
})

export default store
